package tech.summerly.weather.data.remote

import kotlinx.coroutines.experimental.runBlocking
import org.junit.Assert.assertEquals
import org.junit.Test
import tech.summerly.weather.util.Position

/**
 * Created by summer on 18-3-11
 */
class AmapServiceTest {

    @Test
    fun getRegionByPosition() = runBlocking {
        val position = AmapService.getRegionByPosition(Position(110.630213, 26.7331))
        println(position)
    }


    @Test
    fun getRegion() = runBlocking {
        val beiJing = Position(116.481, 39.9896)
        val region = AmapService.getRegionByPosition1(beiJing)
        assertEquals(region.province, "北京市")
        assertEquals(region.city, "北京市")
        assertEquals(region.position, beiJing)
        assertEquals(region.name, "朝阳区望京街道")
        assertEquals(region.fullName, "北京市朝阳区望京街道方恒国际中心A座北京方恒假日酒店")

        val wuGang = Position(110.630213, 26.7331)
        val regionW = AmapService.getRegionByPosition1(wuGang)
        assertEquals(regionW.fullName, "湖南省邵阳市武冈市水西门街道武强路96号")
        assertEquals(regionW.city, "邵阳市")
    }

}